< previous page page_123 next page >

Page 123
0123-01.jpg
Figure 6.10
This grid's pop-up menu provides a
convenient way to initiate program
functions specifically related to the grid.
Creating the Menu to Be Displayed
You create a pop-up menu in the same way that you created the main menu for your programwith the Menu Editor. There is, however, one extra step. The pop-up menu should be hidden so that it does not appear on the menu bar. To hide the menu, you set the Visible property of the top-level menu item to False.
note.gif Typically, you hide the menu item that is used as a pop-up menu, but you can use any of the top-level items of a menu bar as a pop-up menu. That is, a particular menu can appear both as a pop-up menu and as a part of the main menu of a form. square.gif

To illustrate the concept of a pop-up menu, add a simple one to the sample menu system, as follows:
1. Using the Menu Editor, add a new top-level menu item at the end of the list of menu items. Set its Caption property to Format, and its Name property to mnuFormat.
2. Set mnuFormat's Visible property to False.
3. Create these indented menu items under the Format menu:
Caption
Name
&Bold
mnuFormatBold
&Italic
mnuFormatItalic
&Underline
mnuFormatUnderline

4. Close the Menu Editor.
Notice that the Format menu does not appear on your form's menu bar. However, the menu is present and can be modified in the Menu Editor.
The technique you must use to add code to the Click event of the items in a pop-up menu is also a little different. Because the menu is not visible on the form, you cannot just click the item to bring up the Code window. Instead, you bring up the Code window by selecting the View Code button in the Project window or double-clicking the form. Then you can select the desired menu item in the Code window's Object list at the upper-left corner. This way, you can enter code for the hidden items.

 
< previous page page_123 next page >